package day0726API;

public class Test7 {
    public static void main(String[] args) {
        Thread t=Thread.currentThread();
        System.out.println(t.getName());



        Runnable task1=()->{
            Thread thisThread=Thread.currentThread();
            thisThread.setName("线程1");
            System.out.println(thisThread.getName());
            long id=thisThread.getId();
            System.out.println("线程ID：：" + id);
            boolean isAlive=thisThread.isAlive();
            System.out.println("线程是否存活: "  + isAlive);
            int priority=thisThread.getPriority();//获取线程的优先级(10优先级最高)
            System.out.println(priority);
            thisThread.setPriority(10);
            priority=thisThread.getPriority();//获取线程的优先级(10优先级最高)
            System.out.println(priority);
            boolean isInterrupted=thisThread.isInterrupted();
            System.out.println(isInterrupted);
        };
        Thread t1=new Thread(task1);
        t1.start();


      /*  Runnable task2=()->{
            Thread thisThread=Thread.currentThread();
            thisThread.setName("线程2");
            System.out.println(thisThread.getName());
        };
        Thread t2=new Thread(task2);
        t2.start();
*/

    }
}
